package gis.lifay.sdk;

import gis.lifay.sdk.geoserver.GeoSdk;

import java.io.File;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;

/**
 *@ClassName GeoTest
 *@Description TODO
 *@Author lifay
 *@Date 2021/11/2 15:46
 **/
public class GeoTest {
    private static final String FILE_PATH = System.getProperty("user.dir") + File.separator + "Nature.tif";

    private static final String RESTURL = "http://localhost:8070/geoserver";
    private static final String RESTUSER = "admin";
    private static final String RESTPW = "geoserver";

    private static final String WORK_SPACE = "SwBallWorkSpace";
    private static final String STORE_NAME = "";
    private static final String CONVERAGE_NAME = "";


    public static void main(String[] args) throws MalformedURLException, FileNotFoundException {
        //testSdk();
        testDel();
        //testQuery();
    }

    private static void testSdk() throws MalformedURLException, FileNotFoundException {

        String dataStoreName = "testDataStore3";
        String coverageName = "testCoverage3";
        GeoSdk geoSdk = new GeoSdk(RESTURL);
        System.out.println(geoSdk.publishGeoTIFF(WORK_SPACE, dataStoreName, coverageName, FILE_PATH));
    }

    private static void testDel() throws MalformedURLException, FileNotFoundException {

        String dataStoreName = "TESTDEL";
        String coverageName = "TESTDEL";
        GeoSdk geoSdk = new GeoSdk(RESTURL);

        System.out.println(geoSdk.removeCoverageStore(WORK_SPACE, dataStoreName, coverageName));
    }

    private static void testQuery() throws MalformedURLException, FileNotFoundException {

        String dataStoreName = "GPP";
        String coverageName = "GPP";
        GeoSdk geoSdk = new GeoSdk(RESTURL);
        geoSdk.query(WORK_SPACE, dataStoreName, coverageName);

    }
}